import React, { Component } from 'react';
import { BrowserRouter as Router, Route,Redirect } from 'react-router-dom';
import Login from './login'
import AdminIndex from './admin_index'
import { message } from 'antd'
import axios from 'axios'

axios.interceptors.response.use((response)=>{
	if(response.data.resultCode === "0000"){
		message.error("登录失效，请您重新登录")
		window.location.href = "../"
	}
    return response
},(error)=>{
    console.log(error);
})

class Main extends Component{

    render(){
       return (<Router>
            <Route path="/" exact render={
                ()=><Redirect to="/login"/>
            }/>
            <Route path="/login" exact component={Login} />
            <Route path="/article" component={AdminIndex} />
        </Router>)
    }

}
export default Main